package client.Handler;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import protocol.response.MessageResponse;

import java.util.Date;

public class MessageResponseHandler extends SimpleChannelInboundHandler<MessageResponse> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, MessageResponse messageResponse) throws Exception {
//        System.out.println("接收到服务端响应:【" + messageResponse.getMessage() + "】");
        String fromUserId = messageResponse.getFromUserId();
        String fromUserName = messageResponse.getFromUserName();
        System.out.println(new Date() + ":接收到来自【" + fromUserId + "】【" + fromUserName + "】 ->" + messageResponse.getMessage());
    }
}
